<?php
$smarty->configLoad($lang . '/myprofile.module.php');
$language = parse_ini_file($lang . '/breadcrumb.module.php', true);
$breadcrumb = $language['myprofile'];

if(isset($_POST['submit'])) {

	$sql = 'INSERT INTO '.DB_LOGIN.'.account_data
	(
	name,
	password,
	activated,
	access_level,
	email
	) VALUES (
	:name,
	:password,
	:activated,
	:accesslevel,
	:email
	)
	';
	$newpw = base64_encode(sha1($_POST['new_pw'], true));
	$dbh = $connection->prepare($sql);
	$dbh->bindValue(':name', $_POST['name']);
	$dbh->bindValue(':password', $newpw);
	$dbh->bindValue(':email', $_POST['mail']);
	$dbh->bindValue(':accesslevel', $_POST['accesslevel']);
	$dbh->bindValue(':activated', '1');
	$dbh->execute();
	$main->jqmodal('saved');
	echo '<meta http-equiv="refresh" content="5; URL=index.php?mod=myprofile">';
}
$template = 'myprofile/new.tpl';
?>
